package it.uniroma2.art.coda.structures;

import it.uniroma2.art.owlart.model.ARTNode;

import java.util.HashMap;
import java.util.Map;

/**
 * This class represents a single tuple of a result obtained from a SPARQL query
 * @author Andrea Turbati
 *
 */
public class Tuple {
	private Map<String, ARTNode> varMap;
	
	public Tuple(){
		varMap = new HashMap<String, ARTNode>();
	}
	
	/**
	 * Add a variable and its associated ontology resource
	 * @param varId the variable id
	 * @param artNode the ontology resource associated to the variable 
	 * @return true if the variable was not already present in the map, false otherwise
	 */
	public boolean addVarValue(String varId, ARTNode artNode){
		if(varMap.containsKey(varId))
			return false;
		varMap.put(varId, artNode);
		return true;
	}
	
	/**
	 * Get the map containing the variable name and its associated ontology resource
	 * @return the map containing the variable name and its associated ontology resource
	 */
	public Map <String, ARTNode> getTupleMap(){
		return varMap;
	}
}
